<template>
    <router-view  />
</template>

<script lang="ts">
import { provide, ref} from 'vue';
import { router } from './router';

export default {
    name: 'App',  
    setup(){
        const width= ref(document.documentElement.clientWidth);
        const menuVisible = ref(width.value<=500 ? false:true)
        window.onresize=()=>{
            setTimeout(()=>{
                console.log('执行了')
            if(width.value>500){
                menuVisible.value=true;
            }
            },400)   
        }
        provide('menuVisible',menuVisible)
        router.afterEach(()=>{
            if(width.value>500){
                menuVisible.value=true;
            }           
        })
    }
}
</script>


